﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;

namespace MVCBugTracker.Areas.UserManagement.Models
{
    public interface IRoleService
    {
        /// <summary>
        /// Gets or sets the name of the application to store and retrieve role information
        ///     for.
        ///     
        /// Returns:
        ///     The name of the application to store and retrieve role information for.
        /// </summary>
         string ApplicationName { get; set; }

        /// <summary>
        /// Adds the specified users to the specified role.
        /// 
        /// Exceptions:
        ///   System.ArgumentNullException:
        ///     roleName is null.-or-One of the elements in userNames is null.
        ///
        ///   System.ArgumentException:
        ///     roleName is an empty string or contains a comma (,).-or-One of the elements
        ///     in userNames is an empty string or contains a comma (,).-or-userNames contains
        ///     a duplicate element.
        ///
        ///   System.Configuration.Provider.ProviderException:
        ///     Role management is not enabled.
        /// </summary>
        /// <param name="userNames">A string array of user names to add to the specified role.</param>
        /// <param name="roleName">The role to add the specified user names to.</param>
         void AddUsersToRole(string[] userNames, string roleName);

        /// <summary>
        /// Adds the specified users to the specified roles.
        /// 
        /// Exceptions:
        ///   System.ArgumentNullException:
        ///     One of the roles in roleNames is null.-or-One of the users in userNames is
        ///     null.
        ///
        ///   System.ArgumentException:
        ///     One of the roles in roleNames is an empty string or contains a comma (,).-or-One
        ///     of the users in userNames is an empty string or contains a comma (,).-or-roleNames
        ///     contains a duplicate element.-or-userNames contains a duplicate element.
        ///
        ///   System.Configuration.Provider.ProviderException:
        ///     Role management is not enabled.
        /// </summary>
        /// <param name="userNames">A string array of user names to add to the specified roles.</param>
        /// <param name="roleNames">A string array of role names to add the specified user names to.</param>
         void AddUsersToRoles(string[] userNames, string[] roleNames);

        /// <summary>
        /// Adds the specified user to the specified role.
        /// 
        /// Exceptions:
        ///   System.ArgumentNullException:
        ///     roleName is null.-or-userName is null.
        ///
        ///   System.ArgumentException:
        ///     roleName is an empty string or contains a comma (,).-or-userName is an empty
        ///     string or contains a comma (,).
        ///
        ///   System.Configuration.Provider.ProviderException:
        ///     Role management is not enabled. -or-User is already assigned to the specified
        ///     role.
        /// </summary>
        /// <param name="userName">The user name to add to the specified role.</param>
        /// <param name="roleName">The role to add the specified user name to.</param>
         void AddUserToRole(string userName, string roleName);

        /// <summary>
        /// Adds the specified user to the specified roles.
        /// 
        /// Exceptions:
        ///   System.ArgumentNullException:
        ///     One of the roles in roleNames is null.-or-userName is null.
        ///
        ///   System.ArgumentException:
        ///     One of the roles in roleNames is an empty string or contains a comma (,).-or-userName
        ///     is an empty string or contains a comma (,).-or-roleNames contains a duplicate
        ///     element.
        ///
        ///   System.Configuration.Provider.ProviderException:
        ///     Role management is not enabled.
        /// </summary>
        /// <param name="userName">The user name to add to the specified roles.</param>
        /// <param name="roleNames">A string array of roles to add the specified user name to.</param>
         void AddUserToRoles(string userName, string[] roleNames);

        /// <summary>
        /// Adds a new role to the data source.
        /// 
        /// Exceptions:
        ///   System.ArgumentNullException:
        ///     roleName is null.
        ///
        ///   System.ArgumentException:
        ///     roleName is an empty string.-or-roleName contains a comma.
        ///
        ///   System.Configuration.Provider.ProviderException:
        ///     Role management is not enabled.
        /// </summary>
        /// <param name="roleName">The name of the role to create.</param>
         void CreateRole(string roleName);
 
        /// <summary>
        /// Removes a role from the data source.
        /// 
        /// Exceptions:
        ///   System.ArgumentNullException:
        ///     roleName is null.
        ///
        ///   System.ArgumentException:
        ///     roleName is an empty string or contains a comma (,).
        ///
        ///   System.Configuration.Provider.ProviderException:
        ///     roleName has one or more members.-or-Role management is not enabled.
        /// </summary>
        /// <param name="roleName">The name of the role to delete.</param>
        /// <returns>true if roleName was deleted from the data source; otherwise, false.</returns>
         bool DeleteRole(string roleName);
 
        /// <summary>
        /// Removes a role from the data source.
        /// 
        /// Exceptions:
        ///   System.ArgumentNullException:
        ///     roleName is null.
        ///
        ///   System.ArgumentException:
        ///     roleName is an empty string.
        ///
        ///   System.Configuration.Provider.ProviderException:
        ///     roleName has one or more members and throwOnPopulatedRole is true.-or-Role
        ///     management is not enabled.
        /// </summary>
        /// <param name="roleName">The name of the role to delete.</param>
        /// <param name="throwOnPopulatedRole">If true, throws an exception if roleName has one or more members.</param>
        /// <returns>true if roleName was deleted from the data source; otherwise; false.</returns>
         bool DeleteRole(string roleName, bool throwOnPopulatedRole);

        /// <summary>
        /// Gets a list of users in a specified role where the user name contains the
        ///     specified user name to match.
        ///     
        /// Exceptions:
        ///   System.ArgumentNullException:
        ///     roleName is null (Nothing in Visual Basic).-or-userNameToMatch is null.
        ///
        ///   System.ArgumentException:
        ///     roleName is an empty string or contains a comma (,).-or-userNameToMatch is
        ///     an empty string.
        ///
        ///   System.Configuration.Provider.ProviderException:
        ///     Role management is not enabled.
        /// </summary>
        /// <param name="roleName">The role to search in.</param>
        /// <param name="userNameToMatch">The user name to search for.</param>
        /// <returnsA string array containing the names of all the users whose user name matches
        ///     userNameToMatch and who are members of the specified role.returns>
         string[] FindUsersInRole(string roleName, string userNameToMatch);

        /// <summary>
        /// Gets a list of all the roles for the application.
        /// 
        /// Exceptions:
        ///   System.Configuration.Provider.ProviderException:
        ///     Role management is not enabled.
        /// </summary>
        /// <returns>A string array containing the names of all the roles stored in the data source
        ///     for the application.</returns>
         string[] GetAllRoles();
 
        /// <summary>
        /// Gets a list of the roles that a user is in.
        /// 
        /// Exceptions:
        ///   System.ArgumentNullException:
        ///     userName is null.
        ///
        ///   System.ArgumentException:
        ///     userName contains a comma (,).
        ///
        ///   System.Configuration.Provider.ProviderException:
        ///     Role management is not enabled.
        /// </summary>
        /// <param name="userName">The user to return a list of roles for.</param>
        /// <returns>A string array containing the names of all the roles that the specified user
        ///     is in.</returns>
         string[] GetRolesForUser(string userName);

        /// <summary>
        /// Gets a list of users in the specified role.
        /// 
        /// Exceptions:
        ///   System.ArgumentNullException:
        ///     roleName is null.
        ///
        ///   System.ArgumentException:
        ///     roleName is an empty string or contains a comma (,).
        ///
        ///   System.Configuration.Provider.ProviderException:
        ///     Role management is not enabled.
        /// </summary>
        /// <param name="roleName">The role to get the list of users for.</param>
        /// <returns>A string array containing the names of all the users who are members of the
        ///     specified role.</returns>
         string[] GetUsersInRole(string roleName);

        /// <summary>
        /// Gets a value indicating whether the specified user is in the specified role.
        /// 
        /// Exceptions:
        ///   System.ArgumentNullException:
        ///     roleName is null.-or-userName is null.
        ///
        ///   System.ArgumentException:
        ///     roleName is an empty string or contains a comma (,).-or-userName contains
        ///     a comma (,).
        ///
        ///   System.Configuration.Provider.ProviderException:
        ///     Role management is not enabled.
        /// </summary>
        /// <param name="userName">The name of the user to search for.</param>
        /// <param name="roleName">The name of the role to search in.</param>
        /// <returns>true if the specified user is in the specified role; otherwise, false.</returns>
         bool IsUserInRole(string userName, string roleName);

        /// <summary>
        /// Removes the specified user from the specified role.
        /// 
        /// Exceptions:
        ///  System.ArgumentNullException:
        ///   roleName is null.-or-userName is null.
        ///
        ///   System.ArgumentException:
        ///     roleName is an empty string or contains a comma (,)userName is an empty string
        ///     or contains a comma (,).
        ///
        ///   System.Configuration.Provider.ProviderException:
        ///     Role management is not enabled.
        /// </summary>
        /// <param name="userName">The user to remove from the specified role.</param>
        /// <param name="roleName">The role to remove the specified user from.</param>
         void RemoveUserFromRole(string userName, string roleName);

        /// <summary>
        /// 
        /// 
        /// Exceptions:
        ///   System.ArgumentNullException:
        ///     One of the roles in roleNames is null.-or-userName is null.
        ///
        ///   System.ArgumentException:
        ///     One of the roles in roleNames is an empty string or contains a comma (,).-or-userName
        ///     is an empty string or contains a comma (,).-or-roleNames contains a duplicate
        ///     element.
        ///
        ///   System.Configuration.Provider.ProviderException:
        ///     Role management is not enabled.
        /// </summary>
        /// <param name="userName">The user to remove from the specified roles.</param>
        /// <param name="roleNames">A string array of role names to remove the specified user from.</param>
         void RemoveUserFromRoles(string userName, string[] roleNames);

        /// <summary>
        /// Removes the specified users from the specified role.
        /// 
        /// Exceptions:
        ///   System.ArgumentNullException:
        ///     roleName is null.-or-One of the user names in userNames is null.
        ///
        ///   System.ArgumentException:
        ///     roleName is an empty string or contains a comma (,).-or-One of the user names
        ///     in userNames is an empty string or contains a comma (,).-or-userNames contains
        ///     a duplicate element.
        ///
        ///   System.Configuration.Provider.ProviderException:
        ///     Role management is not enabled.
        /// </summary>
        /// <param name="userNames">A string array of user names to remove from the specified roles.</param>
        /// <param name="roleName">The name of the role to remove the specified users from.</param>
         void RemoveUsersFromRole(string[] userNames, string roleName);

        /// <summary>
        /// Removes the specified user names from the specified roles.
        /// 
        /// Exceptions:
        ///   System.ArgumentNullException:
        ///     One of the roles specified in roleNames is null.-or-One of the users specified
        ///     in userNames is null.
        ///
        ///   System.ArgumentException:
        ///     One of the roles specified in roleNames is an empty string or contains a
        ///     comma (,).-or-One of the users specified in userNames is an empty string
        ///     or contains a comma (,).-or-roleNames contains a duplicate element.-or-userNames
        ///     contains a duplicate element.
        ///
        ///   System.Configuration.Provider.ProviderException:
        ///     Role management is not enabled.
        /// </summary>
        /// <param name="userNames">A string array of user names to remove from the specified roles.</param>
        /// <param name="roleNames">A string array of role names to remove the specified users from.</param>
         void RemoveUsersFromRoles(string[] userNames, string[] roleNames);
 
        /// <summary>
        /// Gets a value indicating whether the specified role name already exists in
        ///     the role data source.
        ///     
        /// Exceptions:
        ///   System.ArgumentNullException:
        ///     roleName is null (Nothing in Visual Basic).
        ///
        ///   System.ArgumentException:
        ///     roleName is an empty string or contains a comma (,).
        ///
        ///   System.Configuration.Provider.ProviderException:
        ///     Role management is not enabled.
        /// </summary>
        /// <param name="roleName">The name of the role to search for in the data source.</param>
        /// <returns>true if the role name already exists in the data source; otherwise, false.</returns>
         bool RoleExists(string roleName);
    }
}